<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <head>
    <title>NeuBizz | Blog Single Post | Bootstrap 4 Template by WebThemez</title>

    <!-- Meta -->
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="keywords" content="Bootstrap Theme, Freebies, UI Kit, MIT license">
    <meta name="description" content="Bootstrap 4 Template by WebThemez">
    <meta name="author" content="webthemez.com">

    <!-- Favicon -->
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

    <!-- Styles -->
    <link rel="stylesheet" type="text/css" th:href="@{/assets/vendors/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/vendors/font-awesome/css/fontawesome-all.min.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/vendors/slick-carousel/slick.css}">
	<link th:href="@{/assets/vendors/ace-responsive-menu/ace-responsive-menu.css}" rel="stylesheet" type="text/css" />
	<link th:href="@{/assets/vendors/aos/aos.css}" rel="stylesheet">
	<link rel="stylesheet" type="text/css" th:href="@{/assets/css/theme.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/styles.css}">
	  <!-- 编辑器 -->
    <link rel="stylesheet" th:href="@{/edit/css/style.css}">
	  <!-- pearAdmin -->
	<link rel="stylesheet" th:href="@{/component/pear/css/pear.css}" />
	  <!--css-->
      <style>
          #editor—wrapper {
              border: 1px solid #ccc;
              z-index: 100; /* 按需定义 */
          }
          #toolbar-container { border-bottom: 1px solid #ccc; }
          #editor-container { height: 500px; }
      </style>
  </head>
<body>
   <div class="hidden-xs hidden-sm nav-top bg-primary py-2">
        <div class="container">
          <div class="row">
            <div class="col-sm-6">
              <div class="nav-top-contact">
                <!-- Social links -->
                <ul class="list-inline text-center text-md-left mb-0">
                  <li class="list-inline-item mx-2" ><i class="fa fa-phone"></i> +1-1245-678-980</li>
                  <li class="list-inline-item mx-2" ><i class="fa fa-envelope" aria-hidden="true"></i> info@yourdomain.com</li>
                </ul>
              </div>
            </div>
            <div class="col-sm-6 text-right">
                 <ul class="list-inline text-center text-md-right mb-0">
				  <li class="list-inline-item mx-2" data-toggle="tooltip" data-placement="top" title="Facebook">
					<a target="_blank" href="https://www.facebook.com/Maxi">
					  <i class="fab fa-facebook"></i>
					</a>
				  </li>
				  <li class="list-inline-item mx-2" data-toggle="tooltip" data-placement="top" title="Instagram">
					<a target="_blank" href="https://www.instagram.com/Maxi">
					  <i class="fab fa-instagram"></i>
					</a>
				  </li>
				  <li class="list-inline-item mx-2" data-toggle="tooltip" data-placement="top" title="Twitter">
					<a target="_blank" href="https://twitter.com/Maxi">
					  <i class="fab fa-twitter"></i>
					</a>
				  </li>
				  <li class="list-inline-item mx-2" data-toggle="tooltip" data-placement="top" title="Dribbble">
					<a target="_blank" href="https://dribbble.com/Maxi">
					  <i class="fab fa-dribbble"></i>
					</a>
				  </li>
				</ul>
            </div>
          </div>
        </div>
      </div>
    <!-- Header -->
    <header class="main-header">
	<div class="container">
			<div class="logo">
					<a href="index.html">
						 <h2><span>Neu</span>Bizz</h2>
					  </a>
				</div>
			 <!-- Navbar -->
				<nav class="mainNav">
				<!-- Menu Toggle btn-->
				<div class="menu-toggle">
					<h3>Menu</h3>
					<button type="button" id="menu-btn">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
				</div>
				<!-- Responsive Menu Structure-->
				<!--Note: declare the Menu style in the data-menu-style="horizontal" (options: horizontal, vertical, accordion) -->
				<ul id="respMenu" class="ace-responsive-menu" data-menu-style="horizontal">
					 <li class="active">
						<a href="index">
							<span class="title">Home</span>
						</a>
					</li>
					 <li>
						<a href="about">
							<span class="title">About Us</span>
						</a>
					</li>
					 <li>
						<a href="services">
							<span class="title">Services</span>
						</a>
					</li>
						<li>
						<a href="javascript:;">
							<span class="title">Pages</span>
							<span class="arrow"></span> </a>
						<!-- Level Two-->
						<ul class="sub-menu" style="display: none;">
							<li>
								<a href="pricing">
									<span class="title">Pricing</span>
								</a>
							</li>
							<li>
								<a href="portfolio">
									<span class="title">Portfolio</span>
								</a>
							</li>
							<li>
								<a href="error">
									<span class="title">404 Page</span>
								</a>
							</li>
						</ul>
					</li>
					<li class="menu-active">
						<a href="javascript:;" class="active">
							<span class="title">Blog</span>
							<span class="arrow"></span> </a>
						<!-- Level Two-->
						<ul class="sub-menu" style="display: none;">
							<li>
								<a href="blog" >Blog</a>
							</li>
							<li>
								<a href="blog-single-post">Blog Single</a>
							</li>
						</ul>
					</li>
					<li class="last ">
						<a href="contact">
							<span class="title">Contact Us</span>
						</a>
					</li>
				</ul>
				</nav>
				</div>
    </header>
	  <section class="wt-section bg-gray text-center inner-page-header">
			<div class="container">
				<div class="row justify-content-md-center align-items-center text-white py-4 py-lg-5">
					<div class="col-md-7">
						<div class="text-center">
							<h1 class="display-sm-4 display-lg-3">文 章 提 交 页 面</h1>
							<p class="sub-text">在这里提交你的文章</p>
					  </div>
					</div>
				</div>
			</div>
		</section>
    <main role="main">
<section class="wt-section">
    <div class="container">
        <div class="row justify-content-between">
            <div class="col-lg-12">
                <div class="blog-post">
                    <h3 class="comment-reply-title mb-lg-5 mb-4">
                        文章主体
                    </h3>
                    <div id="editor—wrapper">
                        <div id="toolbar-container"><!-- 工具栏 --></div>
                        <div id="editor-container"><!-- 编辑器 --></div>
                    </div>
                    <div class="meta font-lora mb-3">
                        <a href="#">信息主体</a>
                        <a href="#">这里填写您要发布信息的主体</a>
                    </div>
                </div>
					<section class="wt-section mb-0 pb-0">
					  <!--comments area start-->
				<div class="comment-respond mb-lg-5 mb-4">
                    <h3 class="comment-reply-title mb-lg-5 mb-4">
                        文章信息
                    </h3>
                    <form role="form" class="layui-form" action="">
                        <div class="row">
                            <div class=" col-md-4">
                                <div class="form-group">
                                    <input type="text" name="title" th:value="${articleParam.title}"  class="layui-input" placeholder="文章标题*"  lay-verify="title" required>
                                </div>
                            </div>
                            <div class=" col-md-4">
                                <div class="form-group ">
                                    <input type="contact" name="contact" th:value="${articleParam.contact}"  class="layui-input" placeholder="联系方式*" lay-verify="contact" required >
                                </div>
                            </div>
                            <div class=" col-md-4">
                                <div class="form-group ">
                                    <input type="text" name="area" th:value="${articleParam.area}" class="layui-input" placeholder="面积(可不填)" lay-verify="area">
                                </div>
                            </div>
							<div class=" col-md-4">
								<div class="form-group ">
									<input type="text" name="preciseLocation" th:value="${articleParam.preciseLocation}" class="layui-input" placeholder="具体位置*" lay-verify="preciseLocation" required>
								</div>
							</div>
							<div class=" col-md-4">
								<div class="form-group ">
									<select name="locate" th:value="${articleParam.locate}" lay-verify="locate" required>
										<option value="1">请选择大概的位置</option>
										<option value="1">奎文区</option>
										<option value="2">潍城区</option>
										<option value="3">坊子</option>
										<option value="4">开发区</option>
										<option value="5">什么区</option>
									</select>
								</div>
							</div>
							<div class=" col-md-4">
								<div class="form-group ">
									<select name="financialType" th:value="${articleParam.type}" lay-verify="financialType"required>
										<option value="1">请选择资产类型</option>
										<option value="1">车</option>
										<option value="2">房子</option>
										<option value="3">土地</option>
										<option value="4">世界</option>
										<option value="5">车子</option>
									</select>
								</div>
							</div>
							<div class=" col-md-4">
								<div class="form-group ">
									<select name="type" th:value="${articleParam.financialType}" lay-verify="type"required>
										<option value="1">请选择财产类型</option>
										<option value="1">债券</option>
										<option value="2">物权</option>
										<option value="3">那个权</option>
										<option value="4">这个权</option>
									</select>
								</div>
							</div>
							<div class=" col-md-4">
								<div class="form-group ">
									<label class="layui-form-label">现状</label>
									<input type="checkbox" name="tag" value="1" title="抵押" checked>
									<input type="checkbox" name="tag" value="2" title="查封">
									<input type="checkbox" name="tag" value="3"  title="租赁">
									<input type="checkbox" name="tag" value="4" title="其他">
								</div>
							</div>
                        </div>

                        <div class="form-group">
                            <div class="controls">
                                <textarea id="message"  name="summary" th:value="${articleParam.summary}" rows="5" placeholder="信息简介*" class="layui-textarea" lay-verify="summary" required ></textarea>
                            </div>
                        </div>
                        <p class="text-muted">在这里填写您发布信息的主要内容 *</p>
                        <div class="text-center mt-md-5">
							<button class="layui-btn" lay-submit lay-filter="formEdit">立即提交</button>
                        </div>
                    </form>
                </div>
				</section>

            </div>
        </div>
    </div>
</section>
    </main>


    <!-- Footer -->
<footer class="wt-section bg-dark main-footer">
<div class="container">
<div class="row">
<div class=" col-sm-4 col-md col-sm-4 col-12 col mb-4">
<h5 class="mb-4">Reach us</h5>

<p><i class="fa fa-location-arrow mr-2"></i> #123, Manhatt 7 Avenu, NYC </p>
<p><i class="fa fa-phone mr-2"></i>  +1-1234-567-987  </p>
<p><i class="fa fa fa-envelope mr-2"></i> info@yourdomain.com  </p>


</div>


<div class="col-sm-4 col-md  col-6 col mb-4">
<h5 class="mb-4">Site links</h5>

<ul class="list-inline">
<li class="list-block-item mx-2"><a href="#">Home</a></li>
<li class="list-block-item mx-2"><a href="#">About Us</a></li>
<li class="list-block-item mx-2"><a href="#">Services</a></li>
<li class="list-block-item mx-2"><a href="#">Portfolio</a></li>
<li class="list-block-item mx-2"><a href="#">Pricing</a></li>
</ul>

</div>


<div class="col-sm-4 col-md  col-6 col mb-4">
<h5 class="mb-4">Quick links</h5>

<ul class="list-inline">
<li class="list-block-item mx-2"><a href="#">Blog</a></li>
<li class="list-block-item mx-2"><a href="#">Contact Us</a></li>
<li class="list-block-item mx-2"><a href="#">Privacy Policy</a></li>
<li class="list-block-item mx-2"><a href="http://webthemez.com">Terms & Conditions</a></li>
</ul>

</div>


<div class="col-sm-4 col-md  col-12 col mb-4">
<h5 class="mb-4">Follow us</h5>
<ul class="social_footer_ul list-inline text-left mb-0">
<li class="list-inline-item mx-2"><a href="#"><i class="fab fa-facebook-f"></i></a></li>
<li class="list-inline-item mx-2"><a href="#"><i class="fab fa-twitter"></i></a></li>
<li class="list-inline-item mx-2"><a href="#"><i class="fab fa-linkedin"></i></a></li>
<li class="list-inline-item mx-2"><a href="#"><i class="fab fa-instagram"></i></a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-12 pt-4">

<p class="text-center copyrights"><a class="text-white" href="https://webthemez.com/free-bootstrap-templates/">Bootstrap Theme</a> by WebThemez. <br>© All Rights Reserved</p>
</div>
</div>
</div>
</footer>
    <!-- End Footer -->

    <!-- JS Script Files -->
    <!-- Global Vendor -->
    <script th:src="@{/assets/vendors/jquery.min.js}"></script>
    <script th:src="@{/assets/vendors/jquery.migrate.min.js}"></script>
    <script th:src="@{/assets/vendors/popper.min.js}"></script>
    <script th:src="@{/assets/vendors/bootstrap/js/bootstrap.min.js}"></script>
	<script th:src="@{/assets/vendors/aos/aos.js}"></script>

    <!-- Components Vendor  -->
    <script th:src="@{/assets/vendors/slick-carousel/slick.min.js}"></script>
	   <script th:src="@{/assets/vendors/ace-responsive-menu/ace-responsive-menu.js}"></script>

    <!--Plugin Initialize-->
    <script th:src="@{/assets/js/global.js}"></script>
    <script th:src="@{/assets/vendors/carousel.js}"></script>

   <!--layui-->
    <script th:src="@{/component/layui/layui.js}"></script>
    <script th:src="@{/component/pear/pear.js}"></script>

    <!--文本编辑器-->
    <script th:src="@{/edit/index.js}"></script>


   <!--js编辑器代码-->
   <script>
       const { createEditor, createToolbar} = window.wangEditor

       const editorConfig = {
           placeholder: '文章内容...',
           onChange(editor) {
               const html = editor.getHtml()
               console.log('editor content', html)
               // 也可以同步到 <textarea>
           }
       }

       const editor = createEditor({
           selector: '#editor-container',
           html: '<p><br></p>',
           config: editorConfig,
           mode: 'default', // or 'simple'
       })

       const toolbarConfig = {}

	   //排除没用的工具栏
	   toolbarConfig.excludeKeys = [
		   'group-video', // 去掉视频工具栏
	   ]



	   const toolbar = createToolbar({
           editor,
           selector: '#toolbar-container',
           config: toolbarConfig,
           mode: 'default', // or 'simple'
       })


   </script>
   <!--layui代码-->
   <script>
	   layui.use(['form','jquery'],function () {
		   let form = layui.form;
		   let $ = layui.jquery;
		   let MODULE_PATH = "operate/";
		   //验证
		   form.verify({
			   title: function (value) {
				   if (value.length <= 0) {
					   return '文章标题不能为空';
				   }
			   },
			   contact: function (value) {
				   if (value.length <= 0) {
					   return '联系方式不能为空';
				   }
			   },
			   preciseLocation: function (value) {
				   if (value.length <= 0) {
					   return '具体地址不能为空';
				   }
			   },
			   summary: function (value) {
				   if (value.length <= 0) {
					   return '信息简介不能为空';
				   }
			   },
		   })


		   form.on('submit(formEdit)', function(data) {
			   //获取checkbox[name='like']的值
			   var tag = new Array();
			   $("input:checkbox[name='tag']:checked").each(function(i){
				    tag[i] = $(this).val();
			    });
			   // //data存入数据
			   // var content=editor.getText();
			   // console.log(content.len)
			   // if (content.len()<=50){
				//    layui.msg("文章内容太短！")
				//    return false;
			   // }

			   data.field.tags=tag;
			   data.field.content=editor.getText();
			   data.field.contentHtml=editor.getHtml();

			   $.ajax({
				   url:'/main/edit/post',
				   type:'post',
				   dataType:'json',
				   contentType:'application/json',
				   data:JSON.stringify(data.field),
				   success:function(result){
					   if (result.success) {
						   layer.msg(result.msg,{icon:1,time:1000},function () {
							   //成功   console.log("成功");重新刷新页面
							   parent.location.reload();

						   });
					   }else {
						   layer.msg(result.msg,{icon:2,time:1000},function () {
								//失败，返回文章太短信息
						   });
						   return false;
					   }
				   }
			   })
			   return false;
		   });





	   })

   </script>




    <!-- END JAVASCRIPTS -->
  </body>
</html>
